import type { Config } from '@/types/user'
import styles from './index.module.scss'
type EditListProps = {
  config: Config
  type: 'gender' | 'photo'
  onClose: () => void
}
const EditList = ({ config, type, onClose }: EditListProps) => {
  // 根据type和ocnfig得到需要遍历的类型
  const list = config[type]
  return (
    <div className={styles.root}>
      {list.map((item) => (
        <div className="list-item" key={item.title} onClick={item.onClick}>
          {item.title}
        </div>
      ))}
      <div className="list-item" onClick={onClose}>
        取消
      </div>
    </div>
  )
}
export default EditList
